﻿<Window x:Class="TestWPF.MainWindow" x:Name="myWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:loc="clr-namespace:TestWPF"
        Title="Demo application" Height="350" Width="525">
    <DockPanel>
        <Border DockPanel.Dock="Top" Background="LightGray" BorderThickness="1" BorderBrush="Black" Margin="10,10,10,0" Padding="5">
            <TextBlock TextWrapping="Wrap" Text="Play arround with the settings, move and resize the window, change the selected item in the tabcontrol, then close the app. All the changes you have made to the data, the size and location of the window and the selected tabindex should be preserved."/>
        </Border>
        <TabControl x:Name="tabControl" Margin="10">
            <TabItem Header="General settings" DataContext="{Binding GeneralSettings}">
                <Grid VerticalAlignment="Top">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" x:Name="firstCol"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <GridSplitter HorizontalAlignment="Right" VerticalAlignment="Stretch" Margin="0,0,0,0" Width="5" Grid.RowSpan="3" Panel.ZIndex="199"></GridSplitter>
                    <Label Content="Property1 (int)" Grid.Row="0" Grid.Column="0"/>
                    <TextBox Text="{Binding Property1}" Grid.Row="0" Grid.Column="1"/>
                    <Label Content="Property2 (string)" Grid.Row="1" Grid.Column="0"/>
                    <TextBox Text="{Binding Property2}" Grid.Row="1" Grid.Column="1"/>
                    <CheckBox IsChecked="{Binding Property4}" Grid.Row="2" Grid.ColumnSpan="2" Content="Property4 (bool)" Margin="5"/>
                </Grid>
            </TabItem>
            <TabItem Header="Display settings" DataContext="{Binding DisplaySettings}">
                <DockPanel Margin="10">
                    <ListBox DockPanel.Dock="Left" Name="listFonts" ItemsSource="{x:Static Fonts.SystemFontFamilies}" SelectedItem="{Binding Font}" FontSize="13"/>
                    <StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
                        <Label Content="Font size"/>
                        <TextBox Text="{Binding FontSize, UpdateSourceTrigger=PropertyChanged}" Width="100"/>
                    </StackPanel>
                    <Border BorderThickness="1" Padding="5">
                        <TextBlock FontFamily="{Binding Font}" FontSize="{Binding FontSize}" Text="Sample" Margin="10"/>
                    </Border>
                </DockPanel>
            </TabItem>
        </TabControl>
    </DockPanel>
</Window>
